<!DOCTYPE html>
<html>
<head th:replace="admin/common/html/head :: head(~{::title},~{::link},~{::style})">
    <title>TOMCat添加</title>

    <!-- 这儿引用单独的css link -->
    <!-- Ladda for Bootstrap 3按钮加载进度插件 -->
    <link rel="stylesheet">
    <style type="text/css">
        /**
        *这里写单独的css样式
        */
    </style>
</head>
<body>
<form class="form-horizontal m" id="form-add">
    <div class="form-group">
        <label class="col-sm-3 control-label ">tomcat名称：</label>
        <div class="col-sm-8">
            <input class="form-control" type="text" id="tomcatName" name="tomcatName"/>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-3 control-label ">ip：</label>
        <div class="col-sm-8">
            <input class="form-control"  placeholder="例如:47.122.12.1"  type="text" id="ip" name="ip"/>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-3 control-label ">port：</label>
        <div class="col-sm-8">
            <input class="form-control" placeholder="例如:8080" type="text" id="port" name="port"/>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-3 control-label ">tomcat实际地址：</label>
        <div class="col-sm-8">
            <input class="form-control" placeholder="例如：D:\java\tomcat服务器版本\Alibaba_Dragonwell\apache-tomcat-8.5.47\webapps\" type="text" id="address" name="address"/>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-3 control-label ">管理员账户：</label>
        <div class="col-sm-8">
            <input class="form-control" placeholder="例如:admin" type="text" id="username" name="username"/>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-3 control-label ">管理员密码：</label>
        <div class="col-sm-8">
            <input class="form-control"  placeholder="例如:1" type="text" id="password" name="password"/>
        </div>
    </div>
    <div class="form-group">
        <div class="form-control-static col-sm-offset-9">
            <button type="submit" onclick="add()" class="btn btn-primary">提交</button>
            <button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button>
        </div>
    </div>
</form>

<!-- 通用js -->
<div th:include="admin/common/html/js :: onload_js">
</div>
<script type="text/javascript" th:inline="javascript">
    function add() {


        var dataFormJson = $("#form-add").serialize();
        $.ajax({
            cache: true,
            type: "POST",
            url: rootPath + "/TomcatConfigController/saveTomcat",
            data: dataFormJson,
            async: false,
            error: function (data) {
                $.modal.alertError(data.msg);
            },
            success: function (data) {
                if (data.code != 200) {
                    alert(data.msg);
                    return;
                }
                alert("创建成功")
                if (localStorage.getItem("_tabId")) {
                    refreshTabDataTable()
                } else {
                    window.close();
                }
            }
        });
    }
</script>
</body>
</html>